package com.sgb.jicai.entity;

import android.text.TextUtils;

import com.sgb.jicai.entity.JiCaiRequireEntity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;


public class JiCaiGroupBuyingRuleEntity implements Serializable {

    /**
     * freeKil : 100
     * loadType : 1
     * groupbuyingNo : 1374326659737587712
     * extraRatesCost : 25.0
     * deliveryMethod : 2
     * standardOfServiceCost : 0
     * returnRequirement :
     * groupbuyingRuleCustomizeFields : []
     * logisticsRequirement :
     * warrantyRequirement :
     * freightRules : []
     * mqPushRules : []
     * extraRates : 10
     * paymentRequirement :
     * standardOfServiceCharges : 3
     * repairRequirement :
     * installationRequirement :
     * uploadType : 1
     * qualityRequirement :
     * id : 1396
     * standardOfServiceRatio :
     */

    /**
     * 免费配送距离
     */
    private String freeKil;
    /**
     * 装车要求 1 供方承担 2 需方承担
     */
    private String loadType;
    /**
     * 卸车要求 1 供方承担 2 需方承担
     */
    private String uploadType;
    /**
     * 集采业务编号
     */
    private String groupbuyingNo;
    /**
     * 送货方式 1自提  2 供方配送  3发起方配送
     */
    private String deliveryMethod;
    /**
     * 服务费固定收费费用
     */
    private String standardOfServiceCost;
    /**
     * 服务费收取比例
     */
    private String standardOfServiceRatio;
    /**
     * 退货要求
     */
    private String returnRequirement;
    /**
     * 集采规则自定义字段
     */
    private List<JiCaiRequireEntity> groupbuyingRuleCustomizeFields;
    /**
     * 物流约定
     */
    private String logisticsRequirement;
    /**
     * 质保约定
     */
    private String warrantyRequirement;
    /**
     * 发起方配送-运费规则
     */
    private List<FreightRules> freightRules;
    /**
     * 超出部分收费标准--计算单位
     */
    private String extraRates;
    /**
     * 超出部分收费标准--单位费用
     */
    private String extraRatesCost;
    /*
    * 单位
    * */
    private String unitName;
    /**
     *
     */
    private List<Object> mqPushRules;

    /**
     * 付款约定
     */
    private String paymentRequirement;
    /**
     * 服务收费标准  1.按照成交额比例收取 2按照每单固定收费 3供方承担 4需方承担
     */
    private String standardOfServiceCharges;
    /**
     * 维修约定
     */
    private String repairRequirement;
    /**
     * 安装要求
     */
    private String installationRequirement;
    /**
     * 质量要求
     */
    private String qualityRequirement;
    /**
     *
     */
    private String id;

    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }

    public String getFreeKil() {
        if (TextUtils.isEmpty(freeKil)) return "";
        return freeKil;
    }

    public void setFreeKil(String freeKil) {
        this.freeKil = freeKil;
    }

    public String getLoadType() {
        String name = "";
        if (!TextUtils.isEmpty(loadType)){
            switch (loadType) {
                case "1":
                    name = "供方承担";
                    break;
                case "2":
                    name = "需方承担";
                    break;
            }
        }
        return name;
    }

    public void setLoadType(String loadType) {
        this.loadType = loadType;
    }

    public String getUploadType() {
        if (TextUtils.isEmpty(uploadType)) return "";
        String name = "";
        switch (uploadType) {
            case "1":
                name = "供方承担";
                break;
            case "2":
                name = "需方承担";
                break;
        }
        return name;
    }

    public void setUploadType(String uploadType) {
        this.uploadType = uploadType;
    }

    public String getGroupbuyingNo() {
        return groupbuyingNo;
    }

    public void setGroupbuyingNo(String groupbuyingNo) {
        this.groupbuyingNo = groupbuyingNo;
    }

    public String getDeliveryMethodString() {
        if (TextUtils.isEmpty(deliveryMethod)) return "";
        String name = "";
        switch (deliveryMethod) {
            case "1":
                name = "自提";
                break;
            case "2":
                name = "供方配送";
                break;
            case "3":
                name = "发起方配送";
                break;
        }
        return name;
    }

    public String getDeliveryMethod() {
        if (TextUtils.isEmpty(deliveryMethod)) return "";
        return deliveryMethod;
    }

    public void setDeliveryMethod(String deliveryMethod) {
        this.deliveryMethod = deliveryMethod;
    }

    public String getStandardOfServiceCost() {
        return standardOfServiceCost;
    }

    public void setStandardOfServiceCost(String standardOfServiceCost) {
        this.standardOfServiceCost = standardOfServiceCost;
    }

    public String getStandardOfServiceRatio() {
        return standardOfServiceRatio;
    }

    public void setStandardOfServiceRatio(String standardOfServiceRatio) {
        this.standardOfServiceRatio = standardOfServiceRatio;
    }

    public String getReturnRequirement() {
        if (TextUtils.isEmpty(returnRequirement)) return "";
        return returnRequirement;
    }

    public void setReturnRequirement(String returnRequirement) {
        this.returnRequirement = returnRequirement;
    }

    public List<JiCaiRequireEntity> getGroupbuyingRuleCustomizeFields() {
        return groupbuyingRuleCustomizeFields;
    }

    public void setGroupbuyingRuleCustomizeFields(List<JiCaiRequireEntity> groupbuyingRuleCustomizeFields) {
        this.groupbuyingRuleCustomizeFields = groupbuyingRuleCustomizeFields;
    }

    public String getLogisticsRequirement() {
        if (TextUtils.isEmpty(logisticsRequirement)) return "";
        return logisticsRequirement;
    }

    public void setLogisticsRequirement(String logisticsRequirement) {
        this.logisticsRequirement = logisticsRequirement;
    }

    public String getWarrantyRequirement() {
        return warrantyRequirement;
    }

    public void setWarrantyRequirement(String warrantyRequirement) {
        this.warrantyRequirement = warrantyRequirement;
    }

    public List<FreightRules> getFreightRules() {
        if (freightRules == null){
            freightRules = new ArrayList<>();
        }
        return freightRules;
    }

    public void setFreightRules(List<FreightRules> freightRules) {
        this.freightRules = freightRules;
    }

    public String getExtraRates() {
        if (TextUtils.isEmpty(extraRates)) return "";
        return extraRates;
    }

    public void setExtraRates(String extraRates) {
        this.extraRates = extraRates;
    }

    public String getExtraRatesCost() {
        if (TextUtils.isEmpty(extraRatesCost)){
            extraRatesCost = "0";
        }
        return extraRatesCost;
    }

    public void setExtraRatesCost(String extraRatesCost) {
        this.extraRatesCost = extraRatesCost;
    }

    public List<Object> getMqPushRules() {
        return mqPushRules;
    }

    public void setMqPushRules(List<Object> mqPushRules) {
        this.mqPushRules = mqPushRules;
    }

    public String getPaymentRequirement() {
        if (TextUtils.isEmpty(paymentRequirement)) return "";
        return paymentRequirement;
    }

    public void setPaymentRequirement(String paymentRequirement) {
        this.paymentRequirement = paymentRequirement;
    }

    public String getStandardOfServiceChargesString() {
        String name = "";
        if (!TextUtils.isEmpty(standardOfServiceCharges)){
            switch (standardOfServiceCharges) {
                case "1":
                    name = "按照成交额比例收取";
                    break;
                case "2":
                    name = "按照每单固定收费";
                    break;
                case "3":
                    name = "供方承担";
                    break;
                case "4":
                    name = "需方承担";
                    break;
            }
        }
        return name;
    }
    public String getStandardOfServiceCharges() {
        return standardOfServiceCharges;
    }

    public void setStandardOfServiceCharges(String standardOfServiceCharges) {
        this.standardOfServiceCharges = standardOfServiceCharges;
    }

    public String getRepairRequirement() {
        if (TextUtils.isEmpty(repairRequirement)) return "";
        return repairRequirement;
    }

    public void setRepairRequirement(String repairRequirement) {
        this.repairRequirement = repairRequirement;
    }

    public String getInstallationRequirement() {
        if (TextUtils.isEmpty(installationRequirement)) return "";
        return installationRequirement;
    }

    public void setInstallationRequirement(String installationRequirement) {
        this.installationRequirement = installationRequirement;
    }

    public String getQualityRequirement() {
        if (TextUtils.isEmpty(qualityRequirement)) return "";
        return qualityRequirement;
    }

    public void setQualityRequirement(String qualityRequirement) {
        this.qualityRequirement = qualityRequirement;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public static class FreightRules {
        /**
         * 运费
         */
        private String freight;
        /**
         * 公里数
         */
        private String kilometers;

        public String getFreight() {
            if (TextUtils.isEmpty(freight)) return "";
            return freight;
        }

        public void setFreight(String freight) {
            this.freight = freight;
        }

        public String getKilometers() {
            if (TextUtils.isEmpty(kilometers)) return "";
            return kilometers;
        }

        public void setKilometers(String kilometers) {
            this.kilometers = kilometers;
        }
    }

    public static class GroupbuyingRuleCustomizeFields {
        /**
         * 自定义字段名称
         */
        private String fieldName;
        /**
         * 自定义字段内容
         */
        private String fieldValue;

        public String getFieldName() {
            return fieldName;
        }

        public void setFieldName(String fieldName) {
            this.fieldName = fieldName;
        }

        public String getFieldValue() {
            return fieldValue;
        }

        public void setFieldValue(String fieldValue) {
            this.fieldValue = fieldValue;
        }
    }
}
